<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
                    aria-expanded="false" aria-controls="navbar">
                <span class="sr-only">zblog</span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="{{ url_for('index') }}">{{ g.info.blog_name }}</a>
        </div>
        <div id="navbar" class="collapse navbar-collapse ">
            <ul class="nav navbar-nav">
                {% for f in g.first_bar %}
                    {% if request.url.find(f.url)>=0 %}
                        <li class="active"><a href="{{ f.url }}"><span class="{{ f.icon }}"></span> {{ f.name }}</a>
                        </li>
                    {% else %}
                        <li><a href="{{ f.url }}"><span class="{{ f.icon }}"></span> {{ f.name }}</a></li>
                    {% endif %}
                {% endfor %}
            </ul>
            {% with messages = get_flashed_messages() %}
                {% if messages %}
                    {% for message in messages %}
                        <button id="msg" class="btn navbar-btn btn-warning">
                            <span class="glyphicon glyphicon-comment"></span> {{ message }}
                        </button>
                    {% endfor %}
                {% endif %}
            {% endwith %}
            {% if g.user.is_authenticated() %}
                <div class="pull-right  btn-group ">
                    {% if g.user.is_admin() %}
                        <a href="{{ url_for('article_create') }}" class="btn btn-link navbar-btn">
                            <span class="glyphicon glyphicon-plus blue"></span> 新增文章</a>
                        <button class="btn btn-link dropdown-toggle navbar-btn" data-toggle="dropdown">
                            <i class="glyphicon glyphicon-user red"></i><span class="hidden-sm hidden-xs"> 管理员</span>
                            <span class="caret"></span>
                        </button>
                        <ul class="dropdown-menu ">
                    {% else %}
                        <button class="btn btn-link dropdown-toggle navbar-btn" data-toggle="dropdown">
                            <i class="glyphicon glyphicon-user red"></i><span class="hidden-sm hidden-xs"> 用户</span>
                            <span class="caret"></span>
                        </button>
                        <ul class="dropdown-menu ">
                    {% endif %}
                    <li><a href="/admin/main">
                        <i class="glyphicon glyphicon-wrench "></i> 后台管理</a></li>
                    <li><a href="{{ url_for('usereditinfo') }}">
                        <i class="glyphicon glyphicon-wrench "></i> 个人设置</a></li>
                    <li class="divider"></li>
                    <li><a href="{{ url_for('logout') }}">
                        <i class="glyphicon glyphicon-log-out "></i> 退出系统</a></li>
                    </ul>
                </div>
            {% else %}
                <div class="navbar-right btn-group ">
                    <a href="{{ url_for('register') }}" class="btn btn-link navbar-btn">
                        <span class="glyphicon glyphicon-user red"></span> 注册</a>
                    <a href="{{ url_for('login') }}" class="btn btn-link navbar-btn">
                        <span class="glyphicon glyphicon-log-in red"></span> 登陆</a>
                </div>
            {% endif %}
        </div>
    </div>
</nav>
<br/>
<br/>
<br/>


